import * as actionTypes from './actionTypes'
import axios from 'axios'

export const changeInputAction = (value) => ({
  type: actionTypes.CHANGE_INPUT,
  value
})

export const clickBtnAction = (value) => ({
  type: actionTypes.CLICK_BTN,
  value
})

export const itemClickAction = (value) => ({
  type: actionTypes.ITEM_DELETE,
  value
})

export const queryDataAction = (value) => ({
  type: actionTypes.QUWERY_DATA,
  value
})

export const queryData = () => {
  return (dispatch) => {
    axios.get('https://mock.mengxuegu.com/mock/618e01d94c5d9932f7e761b2/test/getData').then(response => {
      const {data} = response.data
      dispatch(queryDataAction(data.list))
    })
  }
}